﻿using System;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Configuration;
using DropBoxClient.Entities;

namespace DropBoxClient.Tests
{
    [TestClass]
    public class CreateFolderTest
    {
        private string accessToken;
        private OAuth2Client client;
        private Meta meta;

        [TestInitialize]
        public void Init()
        {
            accessToken = ConfigurationManager.AppSettings["AccessToken"];
            client = new OAuth2Client(accessToken);
            meta = client.CreateFolder(StringConstants.SandboxRoot, "MyFolder");
        }

        [TestMethod]
        public void CreateFolder_ResultIsNotNull()
        {
            Assert.IsNotNull(meta);
        }

        [TestMethod]
        public void CreateFolder_PathIsValid()
        {
            Assert.AreEqual("/MyFolder", meta.Path);
        }

        [TestCleanup]
        public void Cleanup()
        {
            client.Delete(StringConstants.SandboxRoot, "MyFolder");
        }
    }
}
